import request from '@/utils/request'
//拉取离线消息
export function getPrivateMsg(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/message/private/pullOfflineMessage`,
		method: 'GET',
		data,
		options: {
			load: false
		}
	})
}
//查询好友信息
export function getFriendInfo(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/friend/find/${data}`,
		method: 'GET',
		options: {
			load: false
		}
	})
}
export function changeRefreshToken(data) {
	return request({
		url: `/xf-api/xf-im-platform/refreshToken`,
		method: 'PUT',
		options: {
			load: false
		}
	})
}

//获取当前聊天用户信息
export function getChatuserInfo(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/user/self`,
		method: 'GET',
		data,
		options: {
			load: false
		}
	})
}
//获取好友列表
export function getFriendLis(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/friend/list`,
		method: 'GET',
		data,
		options: {
			load: false
		}
	})
}
//获取配置信息
export function getChatConfig(data={}) {
	return request({
		url: `/xf-api/xf-im-platform/third/system/config`,
		method: 'GET',
		data,
		options: {
			load: false
		}
	})
}

// 聊天用户登录后调用的接口
export function chatUserInfo(data={}) {
	return request({
		url: `/xf-api/xf-im-platform/im/systemUser/upSysUserInfo`,
		method: 'POST',
		data,
		options: {
			load: false
		}
	})
}
export function addFriend(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/friend/add?friendId=${data.friendId}`,
		method: 'POST',
		options: {
			load: false
		}
	})
}
//判断用户在那个端在线
export function getOnlineStatus(data={}) {
	return request({
		url: `/xf-api/xf-im-platform/third/user/terminal/online`,
		method: 'GET',
		data,
		options: {
			load: false
		}
	})
}
//获取最大已读消息
export function getMaxRead(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/message/private/maxReadedId`,
		method: 'GET',
		data,
		options: {
			load: false
		}
	})
}
//设置已读
export function setRead(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/message/private/readed?friendId=${data.friendId}`,
		method: 'PUT',
		options: {
			load: false
		}
	})
}
//发送消息
export function sendMsg(data) {
	return request({
		url: `/xf-api/xf-im-platform/third/message/private/sendNew`,
		method: 'POST',
		data,
		options: {
			load: false
		}
	})
}
export function sendCard(data) {
	return request({
		url: `/xf-api/xf-im-platform/im/systemUser/isCard`,
		method: 'POST',
		data,
		options: {
			load: false
		}
	})
}
